package com.naiterui.ehp.bs.patient.controller.inner;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BaseExceptionCodes;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.wechat.service.IAccessTokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luao
 * @date 2022/4/21 10:38 AM
 **/
@Api(tags = {SwaggerTag.PATIENT + SwaggerTag.INNER_API + SwaggerTag.SELF_INSPECT})
@RestController
@RequestMapping("ap/inner/self/inspect")
@RequiredArgsConstructor
public class ApInnerSelfInspectController {

    private final IAccessTokenService accessTokenService;

    @ApiOperation(value = "微信服务号自检")
    @GetMapping("/wx/mp/check")
    public void wxMpCheck() throws BusinessException {
        String accessToken = accessTokenService.accessToken();
        if (accessToken == null) {
            throw new BusinessException(BaseExceptionCodes.FAILED, "微信服务号自检失败");
        }
    }
}
